package com.wuhan.template.module.wode.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.wuhan.template.R;
import com.wuhan.template.base.BaseViewHolder;
import com.wuhan.template.base.MyBaseAdapter;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import butterknife.BindView;
import greendao.DetailTable;

/**
 * Created by Administrator on 2016/5/17.
 */
public class CollectionListAdapter extends MyBaseAdapter<DetailTable> {

    private Context context;

    public CollectionListAdapter(Context context, List<DetailTable> list) {
        super(context, list);
        this.context = context;
    }

    @Override
    public int getLayoutId() {
        return R.layout.layout_collection_item;
    }

    @Override
    public BaseViewHolder getViewHolder() {
        return new ViewHolder();
    }

    @Override
    public void bindViews(View view, BaseViewHolder viewHolder) {
        ViewHolder holder = (ViewHolder) viewHolder;
        DetailTable item = getItem(holder.position);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String date = format.format(new Date(item.getTime()));

       /* BaseApplication application = (BaseApplication)context.getApplicationContext();
        application.getImageLoader().displayImage(item.getPicUrl(),holder.imageView);
        */
        holder.mTvTitle.setText(item.getTitle());
        holder.mTvTime.setText(date);
    }

class ViewHolder extends BaseViewHolder{
    @BindView(R.id.sc_pic)
    ImageView imageView;
    @BindView(R.id.sc_title)
    TextView mTvTitle;
    @BindView(R.id.sc_time)
    TextView mTvTime;
}

}
